//
// Created by Administrator on 2022/11/15.
//

#include "http_code.h"

int unicode_decode(unsigned char *desc, char *src) {
    int n = 0;
    for (; *src != '\0'; ++desc, ++src) {
        if(src[0] == '%' && isxdigit(src[1]) && isxdigit(src[2]))
        {
            *desc = hex2dec(src[1]) * 16 + hex2dec(src[2]);

            src += 2;
        }else {
            http_memcpy(desc, src, 1);
        }
        ++n;
    }
    *desc = *src;
    return n;
}